﻿@model StartMVC.Models.MemberLoginViewModel

@{
    ViewBag.Title = "Login";
}

<h2>Login</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>MemberLoginViewModel</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.email)
        </div>
        <div class="editor-field">
            @*@Html.EditorFor(model => model.email)*@
            @Html.TextBoxFor(model => model.email, new { data_val_email="请输入Email地址"})
            @Html.ValidationMessageFor(model => model.email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.password)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.password)
            @Html.ValidationMessageFor(model => model.password)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @if (TempData["LastTempMessage"] != null)
    {

        <script type="text/javascript">
            alert('@HttpUtility.JavaScriptStringEncode(Convert.ToString(TempData["LastTempMessage"]))');
    </script>
        <script>
            $(function () {
                $("#@Html.IdFor(model=>model.email)").rules("add", { message: "请输入Email地址" });
            });
        </script>
}
    <script>
        $(function () {
            $("#@Html.IdFor(model => model.email)").rules("add", { messages: { email: "请输入Email地址" } });
    });
    </script>
}
